﻿using System;
using System.IO.Ports;

namespace Oxage.Drivers
{
	public class NetduinoDriver : IConnector
	{
		private SerialPort port;

		public NetduinoDriver()
		{
			port = new SerialPort();
		}

		#region IConnector Members
		public string Name
		{
			get
			{
				return "Netduino v0.1";
			}
		}

		public void Open()
		{
			port.Open();
		}

		public void Close()
		{
			port.Close();
		}

		public void Write(byte[] data)
		{
			port.Write(data, 0, data.Length);
		}

		public event EventHandler<ConnectorEventArgs> DataReceived;
		#endregion
	}
}
